/*
 * @Author: tangyuhui 317972442@qq.com
 * @Date: 2024-08-29 18:08:41
 * @LastEditors: tangyuhui 317972442@qq.com
 * @LastEditTime: 2024-09-13 10:34:54
 */
// src/components/Sidebar.js
import React, { useState} from 'react';
import { Drawer } from 'antd';
import { Task} from "./types";
import './Sidebar.css'; // 导入 CSS 文件
import {getYunXiaoElements} from './yunxiao'
import "./taskTable.less";
import '../../index.css'
import Board from './Board';
const Sidebar = () => {
  const [visible, setVisible] = useState(false);
  const [elementsData, setElementsData] = useState<Task[]>([]);

  const showDrawer = () => {
    getElements()
    setVisible(true);
  };

  const onClose = () => {
    setVisible(false);
  };

  const getElements = () => {
    const results = getYunXiaoElements()
    setElementsData(results)
  }


  return (
    <>
      <div style={{position: 'fixed', right: "430px", top: "14px" }} className='cursor'  onClick={showDrawer} >
       <img src="https://safesfiles.oss-cn-beijing.aliyuncs.com/safes/ZHNX08073/icon48_202408300032.png" alt=""style={{width:"20px",height:"20px"}} />
       <span className='vertical-align' style={{marginLeft:"5px"}}>云效小助手</span>
      </div>
      <Drawer
        title="云效小助手"
        placement="right"
        onClose={onClose}
        visible={visible}
        width={1200}
      >
        <Board elementsData={elementsData} getElements={getElements}></Board>
      </Drawer>
    </> 
);
};
export default Sidebar